from rest_framework import serializers # 序列化器
from .models import * # 模型

class OptionSerializer(serializers.ModelSerializer):
    '''
    选项序列化器
    '''
    class Meta:
        model = OptionModel # 模型
        fields = '__all__' # 所有字段

class QuestionSerializer(serializers.ModelSerializer):
    '''
    题目序列化器
    '''
    options = OptionSerializer() # 选项
    class Meta:
        model = QuestionModel # 模型
        fields = '__all__' # 所有字段
